package com.demo.zhou.sniper.module;

import org.greenrobot.greendao.annotation.Entity;
import org.greenrobot.greendao.annotation.Id;
import org.greenrobot.greendao.annotation.ToMany;

import java.util.List;
import org.greenrobot.greendao.annotation.Generated;
import org.greenrobot.greendao.DaoException;
import com.demo.zhou.sniper.gen.DaoSession;
import com.demo.zhou.sniper.gen.QunbeanDao;
import com.demo.zhou.sniper.gen.ZubeanDao;

/**
 * Created by zhou on 2017/4/24.
 * 群
 */
@Entity
public class Qunbean {
    @Id
    private Long id;
    private String qun_name;
    @ToMany(referencedJoinProperty = "qunId")
    private List<Zubean> zu;
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#refresh(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 1942392019)
    public void refresh() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.refresh(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#update(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 713229351)
    public void update() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.update(this);
    }
    /**
     * Convenient call for {@link org.greenrobot.greendao.AbstractDao#delete(Object)}.
     * Entity must attached to an entity context.
     */
    @Generated(hash = 128553479)
    public void delete() {
        if (myDao == null) {
            throw new DaoException("Entity is detached from DAO context");
        }
        myDao.delete(this);
    }
    /** Resets a to-many relationship, making the next get call to query for a fresh result. */
    @Generated(hash = 839556333)
    public synchronized void resetZu() {
        zu = null;
    }
    /**
     * To-many relationship, resolved on first access (and after reset).
     * Changes to to-many relations are not persisted, make changes to the target entity.
     */
    @Generated(hash = 2033941492)
    public List<Zubean> getZu() {
        if (zu == null) {
            final DaoSession daoSession = this.daoSession;
            if (daoSession == null) {
                throw new DaoException("Entity is detached from DAO context");
            }
            ZubeanDao targetDao = daoSession.getZubeanDao();
            List<Zubean> zuNew = targetDao._queryQunbean_Zu(id);
            synchronized (this) {
                if(zu == null) {
                    zu = zuNew;
                }
            }
        }
        return zu;
    }
    /** Used for active entity operations. */
    @Generated(hash = 1133125720)
    private transient QunbeanDao myDao;
    /** Used to resolve relations */
    @Generated(hash = 2040040024)
    private transient DaoSession daoSession;
    public String getQun_name() {
        return this.qun_name;
    }
    public void setQun_name(String qun_name) {
        this.qun_name = qun_name;
    }
    public Long getId() {
        return this.id;
    }
    public void setId(Long id) {
        this.id = id;
    }
    /** called by internal mechanisms, do not call yourself. */
    @Generated(hash = 1285097196)
    public void __setDaoSession(DaoSession daoSession) {
        this.daoSession = daoSession;
        myDao = daoSession != null ? daoSession.getQunbeanDao() : null;
    }
    @Generated(hash = 1739416743)
    public Qunbean(Long id, String qun_name) {
        this.id = id;
        this.qun_name = qun_name;
    }
    @Generated(hash = 772332565)
    public Qunbean() {
    }

}
